package com.music.mapper;

import com.music.utils.PlayListInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.jdbc.SQL;

public class UpdatePlayListSqlProvider{

    public String updateActive(@Param("playListInfo") PlayListInfo playListInfo){
        return new SQL(){{
            UPDATE("playlist");
            if (playListInfo.getPlname()!=null){
                SET("plname=#{playListInfo.plname}");
            }
            if (playListInfo.getDesc()!=null){
                SET("`desc`=#{playListInfo.desc}");
            }
            if (playListInfo.getPicUrl()!=null){
                SET("pic=#{playListInfo.picUrl}");
            }
            WHERE("plid=#{playListInfo.plid}");
        }}.toString();
    }
}
